package cn.wolfcode.trip.base.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

@Setter@Getter
public class Answer extends BaseDomain{
    public static final int STATE_NO = 0;//未采用
    public static final int STATE_YES = 1;//已采用

    private User user;//回答的用户

    private Long questionId;//该回答对应的问题id

    private Integer state = STATE_NO;//是否被采用

    private String content;//回答的内容

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date createTime;//回答的时间

    public String getStateName(){
        if (state==STATE_NO){
            return "";
        }
        return "[已采用]";
    }


}